//
//  UIBarButtonItem.swift
//  CJPWB
//
//  Created by 陈锦彭 on 16/3/13.
//  Copyright © 2016年 chenjinpeng. All rights reserved.
//

import UIKit


// MARK: - 初始化UIBarButtonItem
extension UIBarButtonItem {
    ///初始化UIBarButtonItem
    convenience init(imageName : String, target: AnyObject?, action: Selector) {
        let leftBtn = UIButton(type: .Custom)
        leftBtn.setImage(UIImage(named: imageName), forState: .Normal)
        leftBtn.setImage(UIImage(named: imageName + "_highlighted"), forState: .Highlighted)
        leftBtn.sizeToFit()
        leftBtn.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        self.init(customView : leftBtn)
    }

}